/*
 * @lc app=leetcode.cn id=77 lang=golang
 *
 * [77] 组合
 */

// 1. 递归
// @lc code=start
func combine(n int, k int) (ans [][]int) {
	if k == 1 {
		for i := n; i > 0; i-- {
			ans = append(ans, []int{i})
		}
		return
	}

	for i := n; i >= 1; i-- {
		for _, v := range combine(i-1, k-1) {
			ans = append(ans, append([]int{i}, v...))
		}
	}
	return
}

// @lc code=end

